package com.task.manager.mapper;

import com.task.manager.domain.ActionLog;
import org.apache.ibatis.jdbc.SQL;

public class ActionLogSqlProvider {

	public String insertSelective(ActionLog record) {
		SQL sql = new SQL();
		sql.INSERT_INTO("t_action_log");

		if (record.getId() != null) {
			sql.VALUES("ID", "#{id,jdbcType=INTEGER}");
		}

		if (record.getOperator() != null) {
			sql.VALUES("OPERATOR", "#{operator,jdbcType=VARCHAR}");
		}

		if (record.getOperateTime() != null) {
			sql.VALUES("OPERATE_TIME", "#{operateTime,jdbcType=TIMESTAMP}");
		}

		if (record.getAction() != null) {
			sql.VALUES("ACTION", "#{action,jdbcType=LONGVARCHAR}");
		}

		return sql.toString();
	}

	public String updateByPrimaryKeySelective(ActionLog record) {
		SQL sql = new SQL();
		sql.UPDATE("t_action_log");

		if (record.getOperator() != null) {
			sql.SET("OPERATOR = #{operator,jdbcType=VARCHAR}");
		}

		if (record.getOperateTime() != null) {
			sql.SET("OPERATE_TIME = #{operateTime,jdbcType=TIMESTAMP}");
		}

		if (record.getAction() != null) {
			sql.SET("ACTION = #{action,jdbcType=LONGVARCHAR}");
		}

		sql.WHERE("ID = #{id,jdbcType=INTEGER}");

		return sql.toString();
	}
}